package com.gy.smart.util.map;

import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.amap.api.maps2d.model.BitmapDescriptorFactory;
import com.gy.smart.R;

/**
 * @author GY
 * @date 2015/7/2
 * @Description:
 */

public class MapDetailMarker extends MapBaseDrawable<MapSearchBean> {

    private Context context;
    private View mRoot;
    private LayoutInflater inflater;
    private TextView tvTitle,tvPrice;//标题和价钱

    public MapDetailMarker(Context context){
        this.context = context;
        inflater = LayoutInflater.from(context);
        mRoot = inflater.inflate(R.layout.view_amap_detail_marker,null);
        tvTitle = (TextView) mRoot.findViewById(R.id.view_amap_detail_tv_title);
        tvPrice = (TextView) mRoot.findViewById(R.id.view_amap_detail_tv_address);
    }

    @Override
    public Bitmap createMarker(MapSearchBean bean) {
        mRoot = inflater.inflate(R.layout.view_amap_detail_marker,null);
        tvTitle = (TextView) mRoot.findViewById(R.id.view_amap_detail_tv_title);
        tvPrice = (TextView) mRoot.findViewById(R.id.view_amap_detail_tv_address);
        tvTitle.setText(bean.title+"");
        tvPrice.setText(bean.address+"");
        Bitmap bitmap = BitmapDescriptorFactory.fromView(mRoot).getBitmap();
        return bitmap;
    }

}
